﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace TcpTest
{
    class Program
    {
        /// <summary>
        /// 客户端，绑定IP
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            TcpClient client = new TcpClient("127.0.0.1", 7890);
            NetworkStream sendStream = client.GetStream();
            Byte[] sendBytes = Encoding.Default.GetBytes("连接成功1");
            sendStream.Write(sendBytes, 0, sendBytes.Length);
            sendStream.Flush();
            sendStream.Close();//关闭网络流  
            //client.Close();//关闭客户端  
            Console.WriteLine("已经连上服务端");
            Console.Read();
        }
    }
}
